/**
 *博尔信基础开发平台
 *<br> 版权声明：厦门博尔信软件有限公司版权所有,违者必究
 *<br> Copyright:  Copyright (c) 2012
 *<br> Company:pearlsoft
 *<br> @author 蒋勇华
 *<br> 2012-5-7
 *<br> @version 1.0
 *————————————————————————————————————
 *修改记录
 *    修改者：
 *    修改时间：
 *    修改原因：
 *——————————————————————————————————————
 */
package com.pearlsoft.webapp.core.service;

import org.apache.commons.lang.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.pearlsoft.webapp.core.dao.BaseSimpleJdbcDao;

/**
 *描述： 
 *
 * 
 */
@Service
public class BaseSimpleJdbcService implements BaseService{
	@Autowired
	private BaseSimpleJdbcDao baseSimpleJdbcDao;
	public BaseSimpleJdbcDao getBaseSimpleJdbcDao() {
		return baseSimpleJdbcDao;
	}
	protected  void appendLike(StringBuilder buffer,String fieldName,String value){
		buffer.append(" ").append(fieldName).
		append(" like '%").append(value).append("%' ");
	}
	
	protected  boolean appendAndWhereLike(StringBuilder buffer,boolean hasWhere,  String fieldName,String value){
		if( !StringUtils.isBlank(value) ){
			if(!hasWhere){
				buffer.append(" where ");
				hasWhere = true;
			}else{
				buffer.append(" and ");
			}
			appendLike(buffer, fieldName, value);
		}
		return hasWhere;
	}
}
